var choosedCallBackFun;//成功选择之后的回调函数
var templateParams = {
    tableTheads:["分类", "用例名称", "测试步骤","用例类型", "备注", "操作"],
    btnTools:[],
    formControls:[]
};

var columnsSetting = [
    {
        "data":null,
        "width":"25",
        "render":function(data, type, full, meta){
            return checkboxHmtl(data.case_title, data.id, "selectCase");
        }},
    {"data":"id", "width":"55"},
    ellipsisData("classed_path"),
    ellipsisData("case_title"),
    {
        "data":"step_count",
        "width":"55",
        "render":function(data, type, full, meta){
            var context =
                [{
                    type:"default",
                    size:"M",
                    markClass:"show-case-step",
                    name:data || 0
                }];
            return btnTextTemplate(context);
        }
    },
    // ellipsisData("case_type"),
    {"data":"case_type", "width":"50"},
    longTextData("mark", "case_title", "备注信息"),
    {
        "data":null,
        "width":"30",
        "render":function(data, type, full, meta){
            var context = [{
                title:"选择",
                markClass:"object-choose",
                iconFont:"&#xe6ab;"
            }];
            return btnIconTemplate(context);
        }
    }];

var eventList = {
    '.object-choose':function(){
        choosedCallBackFun(table.row( $(this).parents('tr') ).data());
        parent.layer.close(parent.layer.getFrameIndex(window.name));
    },
};

var mySetting = {
    eventList:eventList,
    templateCallBack:function(df){
        choosedCallBackFun = parent[GetQueryString("callback")];
        var case_type = GetQueryString("case_type");
        if (GLOBAL_UTILS.stringUtils.isNotBlank(case_type)) {
            publish.renderParams.listPage.listUrl = REQUEST_URL.WEB_CASE.listCase + "?case_type=" + case_type;
        }

        df.resolve();
    },
    listPage:{
        exportExcel: false,
        listUrl:REQUEST_URL.WEB_CASE.listCase,
        tableObj:".table-sort",
        columnsSetting:columnsSetting,
        columnsJson:[0, 5, 6, 7],
        dtOtherSetting:{serverSide:false}
    },
    templateParams:templateParams
};

$(function(){
    publish.renderParams = $.extend(true,publish.renderParams,mySetting);
    publish.init();
});
